/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021.
 * Description: add share ipi interfaces
 * Author: fuxiancheng
 * Create: 2021/01/16
 */
#include <linux/notifier.h>

static ATOMIC_NOTIFIER_HEAD(ipievent_notif_chain);
int register_ipievent_notifier(struct notifier_block *nb)
{
	int err;

	if ((nb == NULL) || (nb->notifier_call == NULL)) {
		printk("notifier_block is NULL!\n");
		return -1;
	}

	err = atomic_notifier_chain_register(&ipievent_notif_chain, nb);
	return err;
}
EXPORT_SYMBOL_GPL(register_ipievent_notifier);

int unregister_ipievent_notifier(struct notifier_block *nb)
{
	int err;

	if (nb == NULL) {
		printk("notifier_block is NULL!\n");
		return -1;
	}

	err = atomic_notifier_chain_unregister(&ipievent_notif_chain, nb);
	return err;
}
EXPORT_SYMBOL_GPL(unregister_ipievent_notifier);

int call_ipievent_notifiers(unsigned long ipinr, void *cpu)
{
	return atomic_notifier_call_chain(&ipievent_notif_chain, ipinr, cpu);
}
